{assign var='index' value=$listing_search.current_page*$listing_search.listings_per_page-$listing_search.listings_per_page}
{foreach from=$listings item=listing name=listings}
	{if $listing.api}
		{if $api != $listing.api}
			<tr>
				<td colspan="6" style="border-top: 3px solid #B2B2B2;">{$listing.code}<br/></td>
			</tr>
			{assign var="api" value=$listing.api}
			{assign var=api_used_$api value=1} {* this array used to load js-files for multiple api *}
            {assign var='total' value=$smarty.foreach.listings.iteration-1}
		{/if}
		<tr {if $listing.priority == 1}class="priorityListing"{else}class="{cycle values = 'evenrow,oddrow' advance=true}"{/if}>
			<td colspan="6">
				<table>
					<tr>
                       <td rowspan='2'> 
                                                                                                {if $listing.user.Logo.file_url}
                                                    {if !$listing.Confidential}
													<img style='max-width:120px;max-height:80px;' src="{$listing.user.Logo.file_url}" alt="" />
													{else}													
													<img style='max-width:120px;max-height:80px;' src="{$GLOBALS.site_url}/files/pictures/relogo.png" alt="" />
													{/if}                                                  
                                                  {else}
                                                  	{if $listing.Confidential}
                                                  	<img style='max-width:120px;max-height:80px;' src="{$GLOBALS.site_url}/files/pictures/relogo.png" alt="" />
                                                  	{/if}
                                                  {/if}  
												</td>
						<td width="50%">
							<a name="listing_{$listing.id}"></a>
                            <a href="{$listing.url}" {$listing.target} {$listing.onmousedown}><strong>{$listing.Title}</strong></a>
						</td>
						<td width="20%">
							{if $listing.company_name}
								{$listing.company_name}
							{else}
								{$listing.CompanyName}
							{/if}
						</td>
						<td width="20%">{if !$listing.Confidential}
												{$listing.City}111
												{else}
												Confidential
												{/if}</td>
						<td width="10%">[[$listing.activation_date]]</td>
						<td> </td>
					</tr>
					<tr>
						<td> </td>
						{if $show_brief_or_detailed != 'brief'}<td colspan="4">{$listing.JobDescription|strip_tags|truncate:120}</td>
						{else}
							<td colspan="4"></td>
						{/if}
						<td> </td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="6" class="separateListing"> </td>
		</tr>
	{else}
		<tr {if $listing.priority == 1}class="priorityListing"{else}class="{cycle values = 'evenrow,oddrow' advance=true}"{/if}>
			<td colspan="6">
				<table>
					<tr>
                         <td rowspan='2'> 
                                                                                                {if $listing.user.Logo.file_url}
                                                    {if !$listing.Confidential}
													<img style='max-width:120px;max-height:80px;' src="{$listing.user.Logo.file_url}" alt="" />
													{else}													
													<img style='max-width:120px;max-height:80px;' src="{$GLOBALS.site_url}/files/pictures/relogo.png" alt="" />
													{/if}                                                  
                                                  {else}
                                                  	{if $listing.Confidential}
                                                  	<img style='max-width:120px;max-height:80px;' src="{$GLOBALS.site_url}/files/pictures/relogo.png" alt="" />
                                                  	{/if}
                                                  {/if}  
												</td>
						<td width="50%">
							<a name="listing_{$listing.id}"></a>
							<a href="{$GLOBALS.site_url}/display-job/{$listing.id}/{$listing.Title|regex_replace:"/[\\/\\\:*?\"<>|%#$\s]/":"-"}.html?searchId={$searchId}&amp;page={$listing_search.current_page}"><strong>{$listing.Title}</strong></a>
						</td>
						<td width="20%">
							  {if !$listing.Confidential}
													{if $userInfo.CompanyName eq '' }
														{if $listing.company_name}
															<a href="{$GLOBALS.site_url}/search-results-jobs/?action=search&amp;username[equal]={$listing.user.id}&amp;company_name[equal]={$listing.company_name}">{$listing.company_name}</a>
														{else}
															{if strpos($listing.user.CompanyName, '-') !== false}
																<a href="{$GLOBALS.site_url}/search-results-jobs/?action=search&amp;username[equal]={$listing.user.id}">{$listing.user.CompanyName}</a>
															{else}
																<a href="{$GLOBALS.site_url}/company/{$listing.user.id}/{$listing.user.CompanyName|replace:" ":"-"|escape:"url"}">{$listing.user.CompanyName}</a>
															{/if}
														{/if}
													{/if} 
{/if}
						</td>
						<td width="20%">{if !$listing.Confidential}
												{$listing.State}
												{else}
												Confidential
												{/if}</td>
						<td width="10%">[[$listing.activation_date]]</td>
						<td> </td>
					</tr>
					<tr>
						 
						{if $show_brief_or_detailed != 'brief'}<td colspan="4">{$listing.JobDescription|strip_tags|truncate:120}</td>
						{else}
							<td colspan="4"></td>
						{/if}
						<td> </td>
					</tr>
					<tr>
						<td colspan="5">
							<ul>
								<li class="saved2Ico" style='display:none'>
									<span id='notes_{$listing.id}'>
										{if $listing.saved_listing &&  $acl->isAllowed('save_job')}
											{if $listing.saved_listing.note && $listing.saved_listing.note != ''}
												<a href="{$GLOBALS.site_url}/edit-notes/?listing_id={$listing.id}" onclick="SaveAd( 'formNote_{$listing.id}', '{$GLOBALS.site_url}/edit-notes/?listing_sid={$listing.id}'); return false;"  class="action">[[Edit notes]]</a>&nbsp;&nbsp;
											{else}
												<a href="{$GLOBALS.site_url}/add-notes/?listing_id={$listing.id}" onclick="SaveAd( 'formNote_{$listing.id}', '{$GLOBALS.site_url}/add-notes/?listing_sid={$listing.id}'); return false;"  class="action">[[Add notes]]</a>&nbsp;&nbsp;
											{/if}
										{else}
											{if $acl->isAllowed('save_job')}
												<a href="{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}" onclick="{if $GLOBALS.current_user.logged_in}SaveAd('notes_{$listing.id}', '{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}&listing_type=job'){else}popUpWindow('{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}&listing_type=job', 300, 300, 'Save this Job', true, {if $GLOBALS.current_user.logged_in}true{else}false{/if}){/if}; return false;"  class="action">[[Save ad]]</a>&nbsp;&nbsp;
											{elseif $acl->getPermissionParams('save_job') == "message"}
												<a href="{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}" onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=save_job', 300, 300, '[[Save ad]]'); return false;" class="action">[[Save ad]]</a>&nbsp;&nbsp;
											{/if}
										{/if}
									</span>
								</li>
								<li class="viewDetails"><a href="{$GLOBALS.site_url}/display-job/{$listing.id}/{$listing.Title|regex_replace:"/[\\/\\\:*?\"<>|%#$\s]/":"-"}.html?searchId={$searchId}&amp;page={$listing_search.current_page}">[[View job details]]</a></li>
								{if $listing.video.file_url}<li class="viewVideo"><a style="cursor: hand;" onclick="popUpWindow('{$GLOBALS.site_url}/video-player/?listing_id={$listing.id}&amp;field_id=video', 282, 300, 'VideoPlayer'); return false;"  href="{$GLOBALS.site_url}/video-player/?listing_id={$listing.id}&amp;field_id=video">[[Watch a video]]</a></li>{/if}
							</ul>
							<span id = 'formNote_{$listing.id}'>
								{if $listing.saved_listing && $listing.saved_listing.note && $listing.saved_listing.note != ''}
								<b>[[My notes]]:</b> {$listing.saved_listing.note}
								{/if}
							</span><br/>
						</td>
						<td> </td>
					</tr>
				</table>
			</td>
		</tr>

		<tr>
			<td colspan="6" class="separateListing"> </td>
		</tr>

	{/if}
{/foreach}

{if !$GLOBALS.is_ajax}
	<!-- preloader row here -->
	<tr id="ajax_preloader_listings_results" class="preloader">
		<td colspan="6">&nbsp;<img src="{$GLOBALS.site_url}/templates/_system/main/images/ajax_preloader_circular_32.gif" /></td>
	</tr>
{/if}